package com.design.patterns.list.factory.absfactory;

import com.design.patterns.list.factory.absfactory.cola.Cola;
import com.design.patterns.list.factory.absfactory.pizza.Pizza;

/**
 * @author Wangzhiwen
 */
public class OrderPizzaOrCola {

    private AbstractFactory factory;

    public OrderPizzaOrCola() {
    }

    public OrderPizzaOrCola(AbstractFactory factory) {
        this.factory = factory;
    }

    public void setFactory(AbstractFactory factory) {
        this.factory = factory;
    }

    public void orderPizza(String pizzaName){
        Pizza pizza = factory.createPizza(pizzaName);
        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();
    }

    public void orderCola(String colaName){
        Cola cola = factory.createCola(colaName);
        cola.make();
        cola.drink();
    }
}
